<?php
namespace app\admin\controller;
use app\common\model\Admin;
use think\Controller;

class Login extends Controller
{
	
	public function index()
	{
		return $this->fetch();
	}

	public function checkLogin()
	{
		$data = input('post.');

		$user = Admin::get(['username'=>$data['username'],'password'=>md5($data['password'])]);

		if($user){
			session('aid',$user->aid);
			session('username',$user->username);
			$this->success("登录成功");
		}else{
			$this->error('用户或者密码不正确');
		}
	}
}